"""
保险公司 Pydantic 模型
用于 API 请求和响应的数据验证
"""

from typing import Optional
from pydantic import BaseModel, Field
from datetime import datetime, date


class InsuranceCompanyBase(BaseModel):
    """
    基础数据模型
    """
    company_id: str = Field(..., min_length=1, max_length=50, description="保险公司编号")
    company_name: Optional[str] = Field(None, min_length=1, max_length=50, description="保险公司名称")
    address: Optional[str] = Field(None, min_length=1, max_length=50, description="保险公司地址")
    company_phone: Optional[str] = Field(None, min_length=1, max_length=50, description="保险公司电话")
    company_email: Optional[str] = Field(None, min_length=1, max_length=50, description="保险公司邮件")


class InsuranceCompanyCreate(InsuranceCompanyBase):
    """
    创建保险公司的数据模型
    """
    product_name: Optional[str] = Field(default=None, min_length=1, max_length=50, description="保险产品名称")


class InsuranceCompanyResponse(InsuranceCompanyBase):
    """
    返回保险公司的数据模型
    """
    # product_name: Optional[str] = Field(default=None, min_length=1, max_length=50, description="保险产品名称")
    created_at: datetime = Field(..., description="创建时间")
    updated_at: datetime = Field(..., description="更新时间")

    class Config:
        from_attributes = True


class InsuranceCompanyDetailResponse(InsuranceCompanyResponse):
    """
    返回保险公司详细信息的数据模型
    """
    product_name: Optional[str] = Field(default=None, min_length=1, max_length=50, description="保险产品名称")